﻿using Cysharp.Threading.Tasks;
using UnityEngine;

namespace Framework.Task
{
    public class Task_ActiveScene : Task
    {
        public Task_ActiveScene(int factor) : base(factor, "active scene")
        {
            
        }

        protected override async UniTask OnStart()
        {
            await OnFinished();

            AsyncOperation ao = Shared.Shared.loadSceneAo;
            if (ao == null)
                return;

            await UniTask.WaitForSeconds(0.01f);

            ao.allowSceneActivation = true;
            Shared.Shared.loadSceneAo = null;
        }
    }
}